from django.db import models
from l2ldjango.settings import MEDIA_ROOT
from django.contrib.auth.models import User
from datetime import datetime    
from django.template.defaultfilters import slugify
#from l2ldjango.apps.blog.models import * 
from l2ldjango.apps.usermanagement.models import * 

class Firm(models.Model):
    firm_name=models.CharField(null=False,blank=False,max_length=225,verbose_name="Firm Name")
    address=models.CharField(null=False,blank=False,max_length=225,verbose_name="Address")
    city=models.CharField(null=False,blank=False,max_length=225,verbose_name="City")
    phone=models.CharField(null=False,blank=False,max_length=225,verbose_name="Phone")
    phone2=models.CharField(null=True,blank=True,max_length=225,verbose_name="Phone2")
    fax=models.CharField(null=True,blank=True,max_length=225,verbose_name="Fax")
    #area_of_practice=models.TextField(null=False,blank=False,verbose_name="Area Of Practise *")
    area_of_practice=models.ManyToManyField(PracticeArea,null=True,blank=True,related_name="area_of_practice")
    overview=models.TextField(null=False,blank=False,verbose_name="Firm Overview *")
    created_by=models.ForeignKey(User,null=True,blank=True)
    verification_code=models.CharField(null=True,blank=True,max_length=225,verbose_name="Verification Code")
    def __str__(self):
        return self.firm_name
    
class FirmInvitation(models.Model):
    sender=models.ForeignKey(User)
    receiver=models.IntegerField()
    #verification_code=models.CharField(null=False,blank=False,max_length=225,verbose_name="Verification Code")
    firm    =models.ForeignKey(Firm)
    sent_date=models.DateTimeField(verbose_name='Date Invited', auto_now_add=True)
    
class FirmGroup(models.Model):
    member=models.ForeignKey(User)
    firm=models.ForeignKey(Firm)


    